﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace _0712502_0712504_DesignPatternGame
{
    public class ProductManager
    {
        public List<ProductItem> _listItems;
        public ProductManager()
        {
            _listItems = new List<ProductItem>();
        }

        public void Update(GameTime gameTime)
        {
            for(int i = 0; i<_listItems.Count(); i++)
            {
                _listItems.ElementAt(i).Update();
                if (_listItems.ElementAt(i).StateUsed == StateInUse.NotUsed)
                {
                    _listItems.RemoveAt(i);
                }
            }
        }

        public void DrawToScreen(GameTime gameTime, SpriteBatch spriteBatch)
        {
            foreach (ProductItem item in _listItems)
            {
                item.DrawToScreen(gameTime, spriteBatch);
            }
        }

        public void CreateNewItem()
        {
            Random rand = new Random(DateTime.Now.Millisecond);
            int randID = rand.Next(0, 100) % 4;
            ProductItem item;
            switch (randID)
            {
                case 0:
                    break;
                case 1:
                    break;
                case 2:
                    break;
                case 3:
                    break;
                case 4:
                    break;

            }
        }
    }
}
